import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:moose_app/ui/values/values.dart';
import 'package:moose_app/ui/widgets/operator_view.dart';

import 'detail_record_body.dart';

class ATHDetailRecordScreen extends StatelessWidget {
  static final String routeName = "app://detailRecord";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: _buildAppBar(),
      body: ATHDetailRecordBody(),
      bottomNavigationBar: Container(
        height: kSize120,
        color: Colors.white,
        padding: EdgeInsets.symmetric(horizontal: kSize40),
        margin: EdgeInsets.only(bottom: kSize24),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Container(
                width: kSize180,
                padding: EdgeInsets.symmetric(horizontal: kSize10),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(kSize8)),
                    border:
                        Border.all(width: kSize1, color: kColorPrimaryLight),
                    color: kColorF1),
                child: TextField(
                  decoration: InputDecoration(
                    hintText: "说点什么...",
                    hintStyle: TextStyle(fontSize: kFontSize24),
                    border: InputBorder.none,
                    isDense: true,
                    prefixIconConstraints:
                        BoxConstraints(maxHeight: kSize32, maxWidth: kSize32),
                    prefixIcon: SvgPicture.asset(
                      'assets/icons/icon_edit.svg',
                    ),
                  ),
                )),
            ATHOperatorView()
          ],
        ),
      ),
    );
  }

  Widget _buildAppBar() {
    return AppBar(
      centerTitle: false,
      title: Row(
        children: [
          ClipOval(
            child: Container(
              color: Colors.white30,
              child: Image.asset("assets/images/avatar_boy.png",
                  width: kSize80, height: kSize80, fit: BoxFit.cover),
            ),
          ),
          Container(
              margin: EdgeInsets.only(left: kSize20),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    "李白",
                    style:
                        TextStyle(color: Colors.white, fontSize: kFontSize32),
                  ),
                  Row(
                    children: [
                      SvgPicture.asset(
                        "assets/icons/icon_location.svg",
                        height: kSize28,
                        color: Colors.white,
                      ),
                      Text(
                        "大唐",
                        style: TextStyle(
                            color: Colors.white, fontSize: kFontSize20),
                      )
                    ],
                  )
                ],
              ))
        ],
      ),
      actions: [
        Container(
          width: kSize120,
          margin: EdgeInsets.symmetric(horizontal: kSize24),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                padding:
                    EdgeInsets.symmetric(vertical: kSize6, horizontal: kSize16),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(kSize8)),
                    border:
                        Border.all(width: kSize1, color: kColorPrimaryLight)),
                child: Text(
                  "关注",
                  style: TextStyle(color: Colors.white, fontSize: kFontSize28),
                ),
              ),
//              SvgPicture.asset(
//                'assets/icons/operation/icon_share_r.svg',
//                width: kSize38,
//                color: Colors.white,
//              )
            ],
          ),
        ),
      ],
    );
  }
}
